
package com.hexinfo.dmpro.script.config.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hexinfo.dmpro.script.config.dao.RolesPublishuserMapper;
import com.hexinfo.dmpro.script.config.model.RolesPublishuser;
import com.hexinfo.dmpro.script.config.service.RolesPublishuserService;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Package com.hexinfo.dmpro.script.config.service.impl
 * @ClassName RolesPublishuserServiceImpl
 * @Description 角色与发布权限对应中间表
 * @Author le.zhang
 * @Date 2024/3/4 13:15
 * @Version v1.0
 **/
@Service
public class RolesPublishuserServiceImpl extends ServiceImpl<RolesPublishuserMapper, RolesPublishuser> implements RolesPublishuserService {

    /**
     * @Method queryList
     * @Param page
     * @Param rolesPublishuser
     * @Return com.baomidou.mybatisplus.extension.plugins.pagination.Page
     * @Description 分页查询
     * @Author le.zhang
     * @Date 2024/3/4 13:15
     * @Version V1.0
     */
    @Override
    public Page queryList(Page page, RolesPublishuser rolesPublishuser) {
        LambdaQueryWrapper<RolesPublishuser> wrapper = Wrappers.lambdaQuery();
        Page returnPage = this.baseMapper.selectPage(page, wrapper);
        return returnPage;
    }
    /**
     * @Method queryListNoPage
     * @Param id
     * @Return java.util.List<com.hexinfo.dmpro.script.config.model.RolesPublishuser>
     * @Description 不分页查询，通过RoleId精确查
     * @Author le.zhang
     * @Date 2024/3/4 13:15
     * @Version V1.0
     */
    @Override
    public List<RolesPublishuser> queryListNoPage(String id) {
        LambdaQueryWrapper<RolesPublishuser> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(StrUtil.isNotBlank(id),RolesPublishuser::getRoleId,id);
        List<RolesPublishuser> rolesPublishusers = this.baseMapper.selectList(wrapper);
        return rolesPublishusers;
    }

}
